//
//  TableEmptyView.swift
//  ASW
//
//  Created by zhuxuhong on 2020/11/26.
//

import BWUIKit

class TableEmptyHeaderFooter: TableViewHeaderFooter, EmptyReusableView {
    private var empty: EmptyView? {
        didSet{
            guard let v = empty else{
                return
            }
            v.backgroundColor = .clear
            contentView.addSubview(v)
            v.snp.makeConstraints { make in
                make.edges.equalToSuperview()
            }
        }
    }
    
    override func didInit() {
        super.didInit()
        
        empty = loadEmptyView()
    }
    
    override func bwListItemViewConfigure(_ data: Any?, indexPath: IndexPath) {
        guard let data = data as? EmptyDataWrapper else {
            return
        }
        empty?.updateData(data.value)
    }
}
